/*
 * BuyItemStrutsActionForm.java
 *
 * Created on April 24, 2007, 5:37 PM
 */

package com.abbh.libcommunity.struts.beans;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author Abdul Khader J Syed
 * @version
 */

public class BuyItemStrutsActionForm extends org.apache.struts.action.ActionForm {
    private int userId;
    private int itemId;
   
    
    
    
    public BuyItemStrutsActionForm() {
        super();
        // TODO Auto-generated constructor stub
    }
    
   
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getItemId() {
        return itemId;
    }

    public void setItemId(int itemId) {
        this.itemId = itemId;
    }
    
     public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (getUserId() == 0) {
            errors.add("name", new ActionMessage("error.nameid.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        
         if (getItemId() == 0) {
            errors.add("name", new ActionMessage("error.userid.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        
        return errors;
    }

}
